
import time
# def Username(test):
#     def inner(*args,**kwargs):
#         """*args,**kwargs这两个就是函数的传参"""
#         start_time=time.time()
#         Use=input('请输入用户名：')
#         if Use=='abc':
#             test(*args,**kwargs)
#         else:
#             print('用户名输入错误')
#         end_time = time.time()
#         print('输入账号花费费时间为',end_time-start_time)
#     return inner
#
# def Password(test):
#     def fo(*args,**kwargs):
#         start_time=time.time()
#         pwd=int(input("请输入密码："))
#         if pwd==123:
#             test(*args,**kwargs)
#         else:
#             print('输入密码错误')
#         end_time=time.time()
#         print("输入密码花费费时间为",end_time-start_time)
#     return fo



# # @Username
# # @Password
# def buy(*args):
#     print(f"{args}买了股票")
#
# # @Username
# # @Password
# def shell():
#     print('卖股票')
#
#
# # @Username
# # @Password
# def hold(args):
#     print(f"持有股票时间{args}个月")


# if __name__ == '__main__':
    # hold=Username(hold)  #Username(hold)(5)等价于hold=Username(hold)--->hold(5)
    # hold(6)
    # buy1()
    # hold1('3年5个月')
    # Username1(buy1)





import time
def Username1(test):
    def inner(*args,**kwargs):
        start_time=time.time()
        Use=input('请输入用户名：')
        if Use=='abc':
            test(*args,**kwargs)
        else:
            print('用户名输入错误')
        end_time = time.time()
        print("小廖买股票的时间为{}".format(end_time-start_time))
    return inner

def password1(test):
    def inner():
        start_time=time.time()
        pas=input('请输入密码')
        if pas == 123:
            test()
        else:
            print('你输入的密码错误，请重新输入')
        end_time=time.time()
        print('小廖输入密码的时间为{}'.format(end_time-start_time))
    return inner



@Username1  #Username1(buy1)
def buy1():
    print('小廖买股票')
def shell1():
    print('小卖卖股票')
@Username1
def hold1(*args):
    print("持有股票时间为{}".format(args))

if __name__ == '__main__':
    # Username1(shell1)()
    # Username1(hold1('3年5个月'))

    # buy1()
    hold1('111222300')



